package org.adream.account.dao;

import org.adream.account.entity.DomainProfileEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 多站点dao
 * @author: magic chen
 * @date: 2022/8/3 15:11
 **/
@BaseMybatisDao
public interface DomainProfileDao {

    /**
     * selective insert
     *
     * @param record
     * @return
     */
    int insertSelective(DomainProfileEntity record);

    /**
     * selective update
     *
     * @param record
     * @return
     */
    int updateSelective(DomainProfileEntity record);

    /**
     * set dr = 0
     *
     * @param id
     * @return
     */
    int deleteById(@Param("id") String id);


    /**
     * check if site name already exist
     *
     * @param siteName 站点名
     * @return
     */
    DomainProfileEntity checkSiteNameExist(@Param("siteName") String siteName);


    /**
     * check if domain name already exist
     *
     * @param siteId
     * @param domainName
     * @return
     */
    DomainProfileEntity checkDomainNameExist(@Param("siteId") String siteId, @Param("domainName") String domainName);


    /**
     * check if info key already exist of site
     *
     * @param siteId
     * @param dataKey
     * @return
     */
    DomainProfileEntity checkSiteInfoKeyExist(@Param("siteId") String siteId, @Param("dataKey") String dataKey);

    /**
     * get data by id
     *
     * @param id
     * @return
     */
    DomainProfileEntity getById(@Param("id") String id);


    /**
     * get row by domainName
     *
     * @param domainName
     * @return
     */
    DomainProfileEntity getByDomainName(@Param("domainName") String domainName);

    /**
     * get all available domain list
     *
     * @return
     */
    List<DomainProfileEntity> getAvailableSite();

    /**
     * get all info of domain whose parentId is your support
     *
     * @param parentId
     * @return
     */
    List<DomainProfileEntity> getAvailableInfoByParentId(@Param("parentId") String parentId);

}
